import 'package:flutter/material.dart';
import 'package:todo_list/components/base/neu_box.dart';

class UserDrawer extends StatelessWidget {
  const UserDrawer({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Drawer(
        backgroundColor: Colors.grey[350],
        width: MediaQuery.of(context).size.width * 0.6,
        child: ListView(
          children: [
            const DrawerHeader(child: Header()),
            NeuBox(
                padding: const EdgeInsets.symmetric(vertical: 10),
                margin: const EdgeInsets.symmetric(horizontal: 25, vertical: 20),
                child: InkWell(
                    onTap: () {print("退出登录");},
                    child: const Center(
                      child: Text("退出登录", style: TextStyle(color: Colors.black54),),
                    )))
          ],
        ),
      ),
    );
  }
}

class Header extends StatelessWidget {
  const Header({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Column(
      mainAxisAlignment: MainAxisAlignment.spaceAround,
      children: [
        SizedBox(
          width: 80,
          height: 80,
          child: NeuBox(
            borderRadiusSize: 50,
            padding: const EdgeInsets.all(5),
            child: Container(
              width: 80,
              height: 80,
              clipBehavior: Clip.hardEdge,
              decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(50),
              ),
              child: Image.network(
                "https://lmg.jj20.com/up/allimg/1113/011320114330/200113114330-1-1200.jpg",
                fit: BoxFit.cover,
                width: 100,
                height: 100,
              ),
            ),
          ),
        ),
        const Text(
          "衰神",
          style: TextStyle(color: Colors.black54, fontSize: 20),
        )
      ],
    );
  }
}
